# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PrivateCA.V1.Model.CertificateAuthority do
  @moduledoc """
  A CertificateAuthority represents an individual Certificate Authority. A CertificateAuthority can be used to create Certificates.

  ## Attributes

  *   `accessUrls` (*type:* `GoogleApi.PrivateCA.V1.Model.AccessUrls.t`, *default:* `nil`) - Output only. URLs for accessing content published by this CA, such as the CA certificate and CRLs.
  *   `caCertificateDescriptions` (*type:* `list(GoogleApi.PrivateCA.V1.Model.CertificateDescription.t)`, *default:* `nil`) - Output only. A structured description of this CertificateAuthority's CA certificate and its issuers. Ordered as self-to-root.
  *   `config` (*type:* `GoogleApi.PrivateCA.V1.Model.CertificateConfig.t`, *default:* `nil`) - Required. Immutable. The config used to create a self-signed X.509 certificate or CSR.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which this CertificateAuthority was created.
  *   `deleteTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which this CertificateAuthority was soft deleted, if it is in the DELETED state.
  *   `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which this CertificateAuthority will be permanently purged, if it is in the DELETED state.
  *   `gcsBucket` (*type:* `String.t`, *default:* `nil`) - Immutable. The name of a Cloud Storage bucket where this CertificateAuthority will publish content, such as the CA certificate and CRLs. This must be a bucket name, without any prefixes (such as `gs://`) or suffixes (such as `.googleapis.com`). For example, to use a bucket named `my-bucket`, you would simply specify `my-bucket`. If not specified, a managed bucket will be created.
  *   `keySpec` (*type:* `GoogleApi.PrivateCA.V1.Model.KeyVersionSpec.t`, *default:* `nil`) - Required. Immutable. Used when issuing certificates for this CertificateAuthority. If this CertificateAuthority is a self-signed CertificateAuthority, this key is also used to sign the self-signed CA certificate. Otherwise, it is used to sign a CSR.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. Labels with user-defined metadata.
  *   `lifetime` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. The desired lifetime of the CA certificate. Used to create the "not_before_time" and "not_after_time" fields inside an X.509 certificate.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Identifier. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
  *   `pemCaCertificates` (*type:* `list(String.t)`, *default:* `nil`) - Output only. This CertificateAuthority's certificate chain, including the current CertificateAuthority's certificate. Ordered such that the root issuer is the final element (consistent with RFC 5246). For a self-signed CA, this will only list the current CertificateAuthority's certificate.
  *   `satisfiesPzi` (*type:* `boolean()`, *default:* `nil`) - Output only. Reserved for future use.
  *   `satisfiesPzs` (*type:* `boolean()`, *default:* `nil`) - Output only. Reserved for future use.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The State for this CertificateAuthority.
  *   `subordinateConfig` (*type:* `GoogleApi.PrivateCA.V1.Model.SubordinateConfig.t`, *default:* `nil`) - Optional. If this is a subordinate CertificateAuthority, this field will be set with the subordinate configuration, which describes its issuers. This may be updated, but this CertificateAuthority must continue to validate.
  *   `tier` (*type:* `String.t`, *default:* `nil`) - Output only. The CaPool.Tier of the CaPool that includes this CertificateAuthority.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. The Type of this CertificateAuthority.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which this CertificateAuthority was last updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accessUrls => GoogleApi.PrivateCA.V1.Model.AccessUrls.t() | nil,
          :caCertificateDescriptions =>
            list(GoogleApi.PrivateCA.V1.Model.CertificateDescription.t()) | nil,
          :config => GoogleApi.PrivateCA.V1.Model.CertificateConfig.t() | nil,
          :createTime => DateTime.t() | nil,
          :deleteTime => DateTime.t() | nil,
          :expireTime => DateTime.t() | nil,
          :gcsBucket => String.t() | nil,
          :keySpec => GoogleApi.PrivateCA.V1.Model.KeyVersionSpec.t() | nil,
          :labels => map() | nil,
          :lifetime => String.t() | nil,
          :name => String.t() | nil,
          :pemCaCertificates => list(String.t()) | nil,
          :satisfiesPzi => boolean() | nil,
          :satisfiesPzs => boolean() | nil,
          :state => String.t() | nil,
          :subordinateConfig => GoogleApi.PrivateCA.V1.Model.SubordinateConfig.t() | nil,
          :tier => String.t() | nil,
          :type => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:accessUrls, as: GoogleApi.PrivateCA.V1.Model.AccessUrls)

  field(:caCertificateDescriptions,
    as: GoogleApi.PrivateCA.V1.Model.CertificateDescription,
    type: :list
  )

  field(:config, as: GoogleApi.PrivateCA.V1.Model.CertificateConfig)
  field(:createTime, as: DateTime)
  field(:deleteTime, as: DateTime)
  field(:expireTime, as: DateTime)
  field(:gcsBucket)
  field(:keySpec, as: GoogleApi.PrivateCA.V1.Model.KeyVersionSpec)
  field(:labels, type: :map)
  field(:lifetime)
  field(:name)
  field(:pemCaCertificates, type: :list)
  field(:satisfiesPzi)
  field(:satisfiesPzs)
  field(:state)
  field(:subordinateConfig, as: GoogleApi.PrivateCA.V1.Model.SubordinateConfig)
  field(:tier)
  field(:type)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.PrivateCA.V1.Model.CertificateAuthority do
  def decode(value, options) do
    GoogleApi.PrivateCA.V1.Model.CertificateAuthority.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PrivateCA.V1.Model.CertificateAuthority do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
